// 1-票据视图,及关联数据
const {DataTypes, db } = require("../db");
db.define('vInvoice', {
id: {type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true,comment:'表自增ID'},
tenantId:{type: DataTypes.INTEGER,allowNull:false,comment:''}, 
billState:{type: DataTypes.STRING(20),allowNull:false,comment:''}, 
billNo:{type: DataTypes.STRING(128),allowNull:false,comment:''}, 
billDate:{type: DataTypes.STRING(10),allowNull:false,comment:''}, 
billType:{type: DataTypes.STRING(50),allowNull:false,comment:''}, 
transType:{type: DataTypes.INTEGER,allowNull:false,comment:''}, 
files:{type: DataTypes.INTEGER,comment:''}, 
employeeName:{type: DataTypes.STRING(1),allowNull:false,comment:''}, 
billMonth:{type: DataTypes.STRING(1),allowNull:false,comment:''}, 
amountReal:{type: DataTypes.INTEGER,allowNull:false,comment:''}, 
billYear:{type: DataTypes.STRING(1),allowNull:false,comment:''}, 
transTypeName:{type: DataTypes.STRING(50),allowNull:false,comment:''}, 
otherType:{type: DataTypes.STRING(100),comment:''}, 
otherTypeId:{type: DataTypes.INTEGER,comment:''}, 
buId:{type: DataTypes.INTEGER,comment:''}, 
buName:{type: DataTypes.STRING(150),comment:''}, 
linkName:{type: DataTypes.STRING(50),comment:''}, 
linkMobile:{type: DataTypes.STRING(50),comment:''}, 
linkPhone:{type: DataTypes.STRING(50),comment:''}, 
address:{type: DataTypes.STRING(255),comment:''}, 
accId:{type: DataTypes.INTEGER,comment:''}, 
accName:{type: DataTypes.STRING(50),comment:''}, 
accAmount:{type: DataTypes.DECIMAL(20, 2),allowNull:false,comment:''}, 
accId1:{type: DataTypes.INTEGER,comment:''}, 
accName1:{type: DataTypes.STRING(50),comment:''}, 
accAmount1:{type: DataTypes.DECIMAL(20, 2),allowNull:false,comment:''}, 
deliverIds:{type: DataTypes.STRING(255),comment:''}, 
deliverNames:{type: DataTypes.STRING(255),comment:''}, 
salesId:{type: DataTypes.INTEGER,comment:''}, 
salesName:{type: DataTypes.STRING(128),comment:''}, 
doId:{type: DataTypes.INTEGER,comment:''}, 
doName:{type: DataTypes.STRING(128),comment:''}, 
employeeId:{type: DataTypes.INTEGER,comment:''}, 
cby:{type: DataTypes.INTEGER,comment:''}, 
cbyName:{type: DataTypes.STRING(128),comment:''}, 
accountedBy:{type: DataTypes.INTEGER,comment:''}, 
accountedByName:{type: DataTypes.STRING(128),comment:''}, 
sendDate:{type: DataTypes.STRING(10),comment:''}, 
lastPayTime:{type: DataTypes.STRING(10),comment:''}, 
totalAmount:{type: DataTypes.DECIMAL(18, 2),comment:''}, 
totalDiscount:{type: DataTypes.DECIMAL(18, 2),allowNull:false,comment:''}, 
disAmount:{type: DataTypes.DECIMAL(18, 2),allowNull:false,comment:''}, 
amount:{type: DataTypes.DECIMAL(18, 2),allowNull:false,comment:''}, 
ysAmount:{type: DataTypes.DECIMAL(18, 2),allowNull:false,comment:''}, 
rpAmount:{type: DataTypes.DECIMAL(18, 2),allowNull:false,comment:''}, 
arrears:{type: DataTypes.DECIMAL(18, 2),allowNull:false,comment:''}, 
hxAmount:{type: DataTypes.DECIMAL(20, 2),allowNull:false,comment:''}, 
yhAmount:{type: DataTypes.DECIMAL(18, 2),allowNull:false,comment:''}, 
leftAmount:{type: DataTypes.DECIMAL(20, 2),allowNull:false,comment:''}, 
totalQty:{type: DataTypes.DECIMAL(18, 2),comment:''}, 
isYs:{type: DataTypes.INTEGER,comment:''}, 
isYz:{type: DataTypes.TINYINT,comment:''}, 
isFt:{type: DataTypes.TINYINT,comment:''}, 
isGz:{type: DataTypes.TINYINT,comment:''}, 
goods:{type: DataTypes.TEXT,comment:''}, 
remark:{type: DataTypes.STRING(2000),comment:''}, 
subRemark:{type: DataTypes.TEXT,comment:''}, 
isHc:{type: DataTypes.INTEGER,comment:''}, 
isAuto:{type: DataTypes.INTEGER,comment:''}, 
printNo:{type: DataTypes.INTEGER,comment:''}, 
byCell:{type: DataTypes.INTEGER,comment:''}, 
isDelete:{type: DataTypes.TINYINT,comment:''}, 
createdAt:{type: DataTypes.STRING(20),allowNull:false,comment:''}, 
accountedAt:{type: DataTypes.STRING(20),comment:''}, 
wastedAt:{type: DataTypes.STRING(20),comment:''}, 
deletedAt:{type: DataTypes.STRING(20),comment:''}, 
byIid:{type: DataTypes.INTEGER,comment:''}, 
wastedBy:{type: DataTypes.INTEGER,comment:''}, 
deletedBy:{type: DataTypes.INTEGER,comment:''}, 
updatedAt:{type: DataTypes.STRING(20),comment:''}, 
areaId:{type: DataTypes.INTEGER,comment:''}, 
areaName:{type: DataTypes.STRING(100),comment:''}, 
isLoad:{type: DataTypes.INTEGER,comment:''}, 
updatedId:{type: DataTypes.INTEGER,comment:''}, 
printTitle:{type: DataTypes.STRING(255),comment:''}, 
printBar:{type: DataTypes.INTEGER,comment:''}, 
printCodeBar:{type: DataTypes.INTEGER,comment:''}, 
printPhone:{type: DataTypes.STRING(255),comment:''}, 
searchTxt:{type: DataTypes.TEXT,allowNull:false,comment:''}, 
orgin:{type: DataTypes.STRING(255),comment:''}, 

}, {
    tableName: 'v_invoice',
    timestamps: false,
    comment: '1-票据视图,及关联数据',
    
});